let sleep = (time) => new Promise((resolve) => {
    setTimeout(resolve,time)
})

async function changecolor(color,duration) {
    console.log('traffic_light',color);
    await sleep2(duration)
}
async function main() {
    await changecolor('red',2000)
    await changecolor('green',2000)
    await changecolor('yellow',2000)
}
main()